
enum {
	Debug = 0,
	DebugMark = 0,
};

void runtime_gc(int32 force);

void runtime_scan_stacks(void (*scanner)(byte*, uintptr));
void runtime_scan_roots(void (*scanner)(byte*, uintptr));

void runtime_stealcache(void);

// A list of global variables that the garbage collector must scan.
struct root_list {
	struct root_list *next;
	struct root {
		void *decl;
		uintptr size;
	} roots[];
};

void __go_register_gc_roots (struct root_list* r);

static inline bool
runtime_blockspecial(MHeap *h, void *v)
{
	if (DebugMark)
		return true;

	MBits bits;
	runtime_bits_init(&bits, h, v);
	return runtime_bits_read(&bits, bitSpecial);
}

static inline void
runtime_setblockspecial(MHeap *h, void *v, bool s, bool atomic)
{
	if (DebugMark)
		return;

	MBits bits;
	runtime_bits_init(&bits, h, v);
	if (s) {
		runtime_bits_set(&bits, bitSpecial, atomic);
	} else {
		runtime_bits_clear(&bits, bitSpecial, atomic);
	}
}

MCache *runtime_mcache(void);
